<?php
/**
 * 会议消息
 * Created by PhpStorm.
 * User: denh
 * Date: 16/12/2
 * Time: 下午5:36
 */
namespace bs\wxNews;

require_once _LHDir. 'bs/wxNews/Base.php';

class Conference extends Base {

    function addPictureTextNews_1(\Do会议表 $do) {
        $title = $do->get_news_first() ? $do->get_news_first() : $do->get_name();

        if ($do->get_news_first()) {
            $description = $do->get_name();
        } else {
            $description = "会议地点：" . $do->get_会议地点();
        }

        if ($do->get_new_pic_url()) {
            $picUrl = G_SITE_BASE . '/'. $do->get_new_pic_url();
        } else {
            $picUrl = G_SITE_BASE . '/'. $do->get_图片log();
        }

        if ($do->get_news_url()) {
            $url = $do->get_news_url();
        } else {
            $url = \Tools::url('conference', $do->get_下一步(), array('meet_id' => $do->get_id()));
        }

        $this->pictureTextNews->ft添加图文消息($title, $description, $url, $picUrl);
    }

    function addTemplateNews_1(\Do会议表 $do) {
        global $G_CONFIG;

        $time = $do->get_live_video_time() ? $do->get_live_video_time() : $do->get_会议时间();

        if ($do->get_news_url()) {
            $url = $do->get_news_url();
        } else {
            $url = \Tools::url('conference', $do->get_下一步(), array('meet_id' => $do->get_id()));
        }

        $this->templateNews->templateId = $G_CONFIG['模板消息ID']['会议通知'];
        $this->templateNews->url = $url;
        $this->templateNews->data = array(
            'first'=>array('value' => $do->get_news_first(), 'color' => '#173177'),
            'keyword1'=>array('value' => $time, 'color' => '#173177'), //会议时间
            'keyword2'=>array('value' => $do->get_name(), 'color' => '#173177'), //会议主题
            'keyword3'=>array('value' => $do->get_会议地点(), 'color' => '#173177'), //会议地点
            'remark'=>array('value' => $do->get_news_remark(), 'color' => '#173177')
        );
    }

    function addPictureTextNews($userArray = null) {
        $this->pictureTextNews->ft添加图文消息($this->doTemplate->get_pt_title(), $this->doTemplate->get_pt_desc(),
            $this->doTemplate->get_url(), $this->doTemplate->get_pt_pic());
    }

    function addTemplateNews($userArray = null) {
        global $G_CONFIG;

        $this->templateNews->templateId = $G_CONFIG['模板消息ID']['会议通知'];
        $this->templateNews->url = $this->doTemplate->get_url();
        $this->templateNews->data = array(
            'first'=>array('value' => $this->doTemplate->get_template_first(), 'color' => '#173177'),
            'keyword1'=>array('value' => $this->doTemplate->get_template_keyword1(), 'color' => '#173177'), //会议时间
            'keyword2'=>array('value' => $this->doTemplate->get_template_keyword2(), 'color' => '#173177'), //会议主题
            'keyword3'=>array('value' => $this->doTemplate->get_template_keyword3(), 'color' => '#173177'), //会议地点
            'remark'=>array('value' => $this->doTemplate->get_template_remark(), 'color' => '#173177')
        );
    }

    function sendNews($userArray) {
        $this->sendPicTextTemplateNews($userArray);
    }



}